#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os

def create_env_file():
    """创建 .env 文件"""
    env_content = """# 数据库配置
DATABASE_URL=sqlite:///./fortune_telling.db

# JWT 配置
SECRET_KEY=your-secret-key-here-change-this-in-production-2024
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30

# OpenAI 配置
OPENAI_API_KEY=your-openai-api-key-here
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_MODEL=gpt-3.5-turbo
OPENAI_ANALYSIS_MODEL=gpt-3.5-turbo

# 应用配置
APP_NAME=AI生辰八字算命系统
DEBUG=True
"""
    
    try:
        with open('.env', 'w', encoding='utf-8') as f:
            f.write(env_content)
        print("环境配置文件 .env 创建成功！")
        print("请编辑 .env 文件，设置您的 OpenAI API Key")
        return True
    except Exception as e:
        print(f"创建 .env 文件失败: {e}")
        return False

if __name__ == "__main__":
    create_env_file()
